Skip to content

feat(ten-334): add GitHub webhook dispatcher Paperclip plugin#13

Merged
lavie merged 1 commit into
masterfrom
ten-334-github-webhook-dispatcher
May 5, 2026
Merged

feat(ten-334): add GitHub webhook dispatcher Paperclip plugin#13
lavie merged 1 commit into
masterfrom
ten-334-github-webhook-dispatcher

Conversation

@marvin-tensorleap
Copy link
Copy Markdown
Collaborator

Why this change exists

Implements TEN-334 — the GitHub↔TEN mapping architecture (TEN-302) requires a production-grade webhook receiver that routes GitHub events (PR, review, issue, CI failure) directly to wake comments on matching TEN issues, replacing the previous routines-based approach.

How this PR fixes it

A new Paperclip plugin (tensorleap.plugin-github-webhook-dispatcher) is installed locally on the container. For each inbound webhook it:

  1. Verifies HMAC-SHA256 signature from X-Hub-Signature-256
  2. Deduplicates by X-GitHub-Delivery using plugin state
  3. Filters out non-actionable events in code (CI success, labeled, dismissed, etc.)
  4. Extracts the canonical GitHub ref (owner/repo#number)
  5. Searches for the matching TEN issue via ctx.issues.list({ q: "tensorleap/fsd#456" })
  6. Found: posts a wake comment with ## GitHub Event: {event}.{action} header, human summary, and raw payload in <details>
  7. Not found: creates a triage: unmapped tensorleap/fsd#456 issue

Additionally, the SDK's issues.list now exposes q?: string (full-text search) since the underlying server IssueFilters.q already supported it but was not wired to the plugin protocol.

Technical summary

  • New: packages/plugins/examples/plugin-github-webhook-dispatcher/ — full plugin with manifest, worker, 19 unit tests
  • SDK: packages/plugins/sdk/src/protocol.ts — add q?: string to issues.list params
  • SDK: packages/plugins/sdk/src/types.ts — add q?: string to PluginIssuesClient.list
  • SDK: packages/plugins/sdk/src/testing.ts — implement text-search filtering in test harness

Verification

pnpm --filter @tensorleap/plugin-github-webhook-dispatcher test
✓ tests/plugin.spec.ts (19 tests) 14ms
Tests  19 passed (19)

Adds @tensorleap/plugin-github-webhook-dispatcher — a Paperclip plugin
that receives GitHub webhooks from tensorleap repos, filters non-actionable
events in code, and routes actionable ones to matching TEN issues.

- HMAC-SHA256 signature verification via X-Hub-Signature-256
- X-GitHub-Delivery deduplication using plugin state
- Handles: pull_request, pull_request_review, issues, issue_comment, check_suite
- Posts wake comment to matching TEN issue; creates triage issue when ref unmapped
- 19 passing tests

Also exposes q (text-search) param on issues.list in plugin SDK protocol,
types, and test harness.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
@marvin-tensorleap marvin-tensorleap force-pushed the ten-334-github-webhook-dispatcher branch from ad76024 to f671d89 Compare May 5, 2026 11:40
@lavie lavie merged commit fde393b into master May 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants